import math
a, b = map(int, input().strip().split())
for i in [153, 370, 371, 407]:
    if a <= i <= b:
        print(i)
